{include file="admin@public/header" /}

<link rel="stylesheet" href="/public/static/admin/easyui/layui-v2.6.8/css/layui.css">
<!-- <link rel="stylesheet" type="text/css" href="/public/static/admin/easyui/jeasyui/themes/icon.css"> -->

<script type="text/javascript">
  var DOMAIN = document.domain;
  var WDURL = "";
  var SCHEME = "blue";
  try {
    var host = window.location.host;
    var domainDot = host.indexOf('.');
    var domain = host.substring(domainDot + 1, host.length);
    document.domain = domain;
  } catch (e) {
  }
  //ctrl+F5 增加版本号来清空iframe的缓存的
  $(document).keydown(function (event) {
    /* Act on the event */
    if (event.keyCode === 116 && event.ctrlKey) {
      var defaultPage = Public.getDefaultPage();
      var href = defaultPage.location.href.split('?')[0] + '?';
      var params = Public.urlParam();
      params['version'] = Date.parse((new Date()));
      for (i in params) {
        if (i && typeof i != 'function') {
          href += i + '=' + params[i] + '&';
        }
      }
      defaultPage.location.href = href;
      event.preventDefault();
    }
  });
</script>

<link href="/public/static/admin/blue/bills.css" rel="stylesheet" type="text/css">

<style>
  /*#barCodeInsert{margin-left: 10px;font-weight: 100;font-size: 12px;color: #fff;background-color: #B1B1B1;padding: 0 5px;border-radius: 2px;line-height: 19px;height: 20px;display: inline-block;}*/
  /*#barCodeInsert.active{background-color: #23B317;}*/
  .url-box {
    padding: 5px 10px;
    line-height: 20px;
    cursor: pointer;
  }

  .url-box a {
    margin-right: 5px;
  }

  #editBills {
    background: url(/public/static/admin/css/img/edit.png);
    display: inline-block;
    width: 13px;
    height: 12px;
  }

  #check_history {
    background: green;
    border-radius: 10px 10px;
    width: 80px;
    text-align: center;
  }

  #check_history a {
    color: #fff;
  }

  .wrapper_con {
    overflow-y: auto;
    overflow-x: hidden;
  }

  .ui-jqgrid a.srcOrderNo {
    text-decoration: none;
    cursor: pointer;
  }

  .ui-jqgrid a.srcOrderNo:hover {
    text-decoration: none;
  }
  .layui-form-radio{
    margin-top: 0;
  }
  .layui-form-radio>i:hover, .layui-form-radioed>i{
    color: #3CBAFF;
  }
  .pcnone{display: none !important;}
</style>

<div class="wrapper">
  <div class="mod-toolbar-top mr0 cf dn" id="toolTop"></div>
  <div class="bills cf layui-form">
    <div class="con-header">
      <dl class="cf">
        <dd class="mr20">
          <label><span class="red">*</span>供应商:</label>
          <span class="ui-combo-wrap" id="customer" style="width: 198px;">
          
          <i class="ui-icon-ellipsis"></i><input type="text" name="" class="input-txt" autocomplete="off" value="" data-ref="date" style="width: 188px;"></span></dd>
        <dd class="mr20">
          <label>单据日期:</label>
          <input type="date" id="date" class="ui-input " value="2021-08-09" style="width: 125px;">
        </dd>
        <dd class="mr20">
          <label>交货日期:</label>
          <input type="date" id="deliveryDate" class="ui-input" value="2021-08-09" style="width: 125px;">
        </dd>
        <dd id="classes" class="mr20">
            <input type="radio" name="sex" value="购货" title="购货" checked="">
            <input type="radio" name="sex" value="退货" title="退货">
        </dd>
        <!-- <dd class="mr20">
          <span class="url-box" id="openUrl"><a href="https://club.kingdee.com/club/newclub/school/course?product_id=7&amp;cid=1548#pid=5703" target="_blank" class="video-icon"></a>购货订单录入 </span>
          <span class="url-box" id="open_Url"><a href="https://club.kingdee.com/club/newclub/school/course?product_id=7&amp;cid=1548#pid=5706" target="_blank" class="video-icon"></a>购货订单分批入库</span>
        </dd> -->
        <!-- <dd id="identifier" style="float:right;">
          <label>单据编号:</label>
          <span id="number">GHDD20210809001</span></dd> -->
          <dd id="identifier" style="float:right">
            <label>单据编号:</label>
            <span id="number" >GHDD20210809001</span>
            <i id="editBills" ></i>

            <span class="ui-combo-wrap ui-combo-active ctn-wrap" id="storage1" style="display: none;position: relative;overflow: visible;">
              <input type="text" class="input-txt" autocomplete="off" id="storageInput1" value="GHDD20210809001"><i class="trigger"></i>
              <div class="ui-droplist-wrap" id="storageList1"	style="position: absolute; top: 30px; z-index: 1000; width: 100%; display: none; left: 0;">
                <div class="droplist"  style="position: relative; overflow: auto; min-height: 150px; height: 150px;">
                  <div class="list-item" onclick="chooseSelect('1','0','GHDD202108090012')">GHDD202108090012</div>
                </div>
              </div>
            </span>
            
          </dd>

      </dl>
      <hr class="hrcls">
    </div>

    <div class="wrapper_con">
      <!-- <div class="cf mb10">
		  <div class="fl">
			<span  id="config" class="ui-config"><a href="#" class="ui-icon-config-new"></a>列设置</span>
			<span><label>扫描枪录入</label><span id="barCodeInsert" class="close"><span class="ui-icon-circle"></span></span></span>
		  </div>
		  <div class="fr">
			<span class="circle-link-order linkToCheck"><a href="#" class="icon-link-order"></a>历史单据</span>
		  </div>
		</div> -->
      <span id="config" class="ui-config"><a href="#" class="ui-icon-config-new"></a></span>
      <div class="grid-wrap">
        <table id="grid"></table>
        <div id="page"></div>
      </div>
      <div class="cf" id="bottomField">
        <span id="groupBtn">
          <a id="import" class="ui-btn ui-btn-search">批量导入</a>
          <a id="savaAndAdd" class="ui-btn ui-btn-sp">保存并新增</a>
          <a id="save" class="ui-btn">保存</a>
        </span>
      </div>
      <div id="mark"></div>
    </div>

    <div class="con-footer cf">
      <div class="mb10">
        <textarea type="text" id="note" class="ui-input ui-input-ph" placeholder="暂无备注信息"></textarea>
      </div>
      <ul id="amountArea" class="cf">
        <li>
          <label>优惠率:</label>
          <input type="text" id="discountRate" class="ui-input" data-ref="deduction" placeholder="0.00">%
        </li>
        <li>
          <label>优惠金额:</label>
          <input type="text" id="deduction" class="ui-input" data-ref="payment" placeholder="0">
        </li>
        <li>
          <label>优惠后金额:</label>
          <input type="text" id="discount" class="ui-input ui-input-dis" data-ref="discountRate" disabled  placeholder="0.00">
        </li>
      </ul>
      <ul class="dn">
        <li>
          <label id="paymentTxt">本次付款:</label>
          <input type="text" id="payment" class="ui-input">&emsp;
        </li>
        <li id="accountWrap" class="dn">
          <label>结算账户:</label>
          <span class="ui-combo-wrap" id="account" style="padding:0;">
            <input type="text" class="input-txt" autocomplete="off">
            <i class="trigger"></i></span><a id="accountInfo" class="ui-icon ui-icon-folder-open"
            style="display:none;"></a>
        </li>
        <li>
          <label>本次欠款:</label>
          <input type="text" id="arrears" class="ui-input ui-input-dis" disabled>
        </li>
        <li>
          <label>累计欠款:</label>
          <input type="text" id="totalArrears" class="ui-input ui-input-dis" disabled>
        </li>
      </ul>
      <ul id="user-field">
        <v-input v-for="(item, index) in udfData" :title="item.name" :type="item.type" v-model="item.value"
          :items="item.items" :metaid="item.metaId" :readonly="isChecked" :key="item.metaId"></v-input>
        <li class="udfLink">
          <v-user-field :transtype="transtype" :udfdata="udfData"></v-user-field>
        </li>
      </ul>
      <!-- <ul id="user-field"> <li class="udfLink"><a class="user-field">自定义字段</a></li></ul> -->
      <!--  <ul class="c999 cf">
		  <li>
			<label>制单人:</label>
			<span id="userName"></span>
		  </li>
		  <li>
			<label>审核人:</label>
			<span id="checkName"></span>
		  </li>
		  <li>
			<label>录单时间:</label>
			<span id="createTime"></span>
		  </li>
		  <li>
			<label>最后修改时间:</label>
			<span id="modifyTime"></span>
		  </li>
		</ul> -->
      <div class="cf fr">
        <a href="#" class="linkToCheck ui-btn-bill ui-btn-add mr20">历史单据</a>
        <a href="#" id="operaLog" class="ui-btn">操作日志</a>
      </div>
    </div>


    <div id="initCombo" class="dn">
      <input type="text" class="textbox goodsAuto" name="goods" autocomplete="off">
      <input type="text" class="textbox storageAuto" name="storage" autocomplete="off">
      <input type="text" class="textbox unitAuto" name="unit" autocomplete="off">
      <input type="text" class="textbox priceAuto" name="price" autocomplete="off">
      <input type="text" class="textbox skuAuto" name="price" autocomplete="off">
    </div>
    
    <div id="discountRateBox" class="shadow target_box dn"></div>
    <div id="goodsDiscountRateBox" class="shadow target_box dn"></div>
    <div id="deductionBox" class="shadow target_box dn"></div>
    <div id="snapshotTipsBox" class="shadow target_box dn"></div>
    <ul id="operaLogBox" class="shadow opera-log-box dn">
      <li>
        <span class="fl" style="margin-right: 50px;"><label>制单人：</label><span id="userName"
            style="margin-left: 12px;"><span open-data></span></span></span>
      </li>
      <li>
        <span class="fl"><label>制单时间：</label><span id="createTime"></span></span>
      </li>
      <li>
        <span class="fl"><label>审核人：</label><span id="checkName" style="margin-left: 12px;"></span></span>
      </li>
      <li>
        <span class="fl"><label>审核时间：</label><span id="checkTime"></span></span>
      </li>
      <li>
        <span class="fl"><label>最后修改人：</label><span id="modifyName" style="margin-left: 12px;"></span></span>
      </li>
      <li>
        <span class="fl"><label>最后修改时间：</label><span id="modifyTime"></span></span>
      </li>
    </ul>
  </div>

  <div id="storageBox" class="shadow target_box dn pcnone" style="position: absolute; left: 705.65px; top: 133.688px; z-index: 999; display: block;">
    <ul><li data-id="129127919158566" data-name="默认仓库">CK001 默认仓库</li></ul>
  </div>

</div>
<script type="text/javascript">
  $(document).ready(function () {

    $("#grid").jqGrid({
				url: '/admin/store/index.html?ajax=100',
				datatype: "json",//数据来源，本地数据（local，json,jsonp,xml等）
				height: '90%',//高度，表格高度。可为数值、百分比或'auto'
				//width: Public.setGrid().w,
				//height: Public.setGrid().h,
				colNames: ['','<span class="red">*</span>商品<label> -- 扫描枪录入</label><span id="barCodeInsert" class="open"><span class="ui-icon-circle"></span></span>', '商品备注', '单位', '<span class="red">*</span>仓库<small id="batchStorage" onclick="batchBtn();">批量</small>'],
				colModel: [
					{ name: 'id', index: 'id', width: 110,  },
					{ name: 'goods', width: 300,   summaryType:'sum'},
					{ name: 'bh', width: 100 },
					{ name: 'name', index: 'name asc', width: 100 },
					{ name: 'status', index: 'name asc',  },
				],
				rowNum: 10,
				rowList: [10, 20, 30],
				sortname: 'id',
				sortorder: "desc",
				pagerpos: "left",//分页位置

				pgbuttons: true,//翻页按钮
				pagination: true,
				altRows: !0,
				gridview: !0,
				shrinkToFit: !1,
				cellLayout: 8,
				autowidth: !0,
				pager: "#page",
				viewrecords: !0,
				cmTemplate: {
					sortable: !1,
					title: !1
				},
				loadError: function (t, e, i) {
					parent.Public.tips({
						type: 1,
						content: "操作失败了哦，请检查您的网络链接！"
					})
				}
			});



    // 下拉选择
    $(".ctn-wrap .trigger").click(function () {
        $(this).next(".ui-droplist-wrap").toggle();
      });
      // 点击下拉框其他位置隐藏
      $(document).click(function () {
        // $(".ui-droplist-wrap").hide();
        // if($("#storage1").css('display')=="block"){
          $("#editBills").show();
          $("#number").show();
          $("#storage1").hide();
        // }
        
      });
      // 阻止冒泡
      $(".ctn-wrap,#editBills").click(function (event) {
        event.stopPropagation();
      });

      // 点击编辑单据编号
      $("#editBills").click(function(){
        $("#editBills").hide();
        $("#number").hide();
        $("#storage1").show();
      });
  });

  // 批量按钮事件
  function batchBtn(){
      if($("#storageBox").hasClass("pcnone")) {
        $("#storageBox").removeClass('pcnone');//removeClass
      }else{
        $("#storageBox").addClass('pcnone');  
      }    
       
       
  }   

  // 下拉选择
  function chooseSelect(id, value, text) {
			console.log(value, text)
			$("#storageInput" + id).val(text);
			storageList(id);
		}

		// 关闭下拉选择
		function storageList(id) {
			$("#storageList" + id).hide();
		}
</script>
<!-- <script src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script src="https://open.work.weixin.qq.com/wwopen/js/jwxwork-1.0.0.js"></script>
<script src="/js/dist/apphost.js?ver=20210803202401"></script>
<script src="/js/common/vue-components.js?ver=20210803202401"></script>
<script src="/js/dist/purchaseOrder.js?ver=20210803202401"></script> -->
{include file="admin@public/footer" /}